package com.charmzenus.message.redis2;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class RedisMessageListener implements MessageListener {

    protected Logger logger = LoggerFactory.getLogger(RedisMessageListener.class);


    @Override
    public void onMessage(Message message, byte[] pattern) {
        String key = message.toString();
        try {
            System.out.println("Message received: " + message.toString());
            logger.info("Message received: " + message.toString());

        } catch (Exception e) {
            logger.error("handler expire key error" + key, e);
        }
    }
}
